package com.sca.deal.config;

import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import javax.sql.DataSource;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.logging.Logger;

@Configuration
public class DataSourceConfig {



    @Primary
    @Bean(name="productDataSource")
    @ConfigurationProperties(prefix = "spring.datasource.druid.product")
    public DataSource productDataSource() {
        return DruidDataSourceBuilder.create().build();
    }

    @Bean(name="orderDataSource")
    @ConfigurationProperties(prefix = "spring.datasource.druid.order")
    public DataSource orderDataSource() {
        return DruidDataSourceBuilder.create().build();
    }
}
